package com.inepex.graphicstests.client.misc.widgets;

import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Label;

public class SizeInput extends Composite {

	private Label title;
	private HorizontalPanel mainPanel;
	private NumericTextBox width;
	private NumericTextBox height;
	
	public SizeInput(String title, int defWidth, int defHeight) {
		mainPanel = new HorizontalPanel();
		this.title = new Label(title);
		width = new NumericTextBox(defWidth);
		height = new NumericTextBox(defHeight);
		mainPanel.add(this.title);
		mainPanel.add(width);
		mainPanel.add(new Label("x"));
		mainPanel.add(height);
		initWidget(mainPanel);
	}
	
	public int[] getSize(){
		return new int[]{width.parseIntValue(), height.parseIntValue()};
	}
	
	public int getWidth(){
		return width.parseIntValue();
	}
	
	public int getHeight(){
		return height.parseIntValue();
	}
	
}
